﻿

function TestCoroutine()
	local i=0;
	while(true)do
		coroutine.wait(1)
		print(i)
		i=i+1;
	end
end

function DownImage()
	local www = UnityEngine.WWW("http://www.baidu.com")
	coroutine.www(www)--yield return www;
	local s = tolua.tolstring(www.bytes)
	print(s);
    print('Coroutine ended')
end



co = coroutine.start(TestCoroutine)

coroutine.start(DownImage)

print("开启ulua协程")


function StopCo()
	coroutine.stop(co);
end